<template>
	<el-main>
		<el-form ref="form" :model="form" label-width="80px">
			<el-form-item label="合同名称">
				<el-input v-model="form.mingcheng" placeholder="请输入名称"></el-input>
			</el-form-item>
			<el-form-item label="合同编号">
				<el-input v-model="form.bianma" placeholder="请输入编号"></el-input>
			</el-form-item>
		</el-form>
		    <el-button @click="dialogVisible = false">取 消</el-button>
		    <el-button type="primary" @click="save">确 定</el-button>
	</el-main>
</template>

<script>
	export default {
		data(){
			return {
				form:{},
			}
		},
		methods:{
			save(){
				this.form.addShijian=null;
				this.axios.post(this.$baseUrl+"hetong/save",this.form).then(res=>{
					if(res.data.result){
						this.$message.success("添加成功");
						this.$router.push("/hetong");
					}else {
						this.$message.error(res.data.message);
					}
				})
			}
		},
		created(){
			let id = this.$route.query.id;
			console.log(id);
			if (id != null) {
				this.axios.get(this.$baseUrl+"hetong/getById",{params:{id:id}}).then(res=>{
					this.form = res.data.data || {};
				});
			}

		}
	}
</script>

<style scoped>

</style>
